package com.iflytek.day17;

interface Swim {
  public abstract void swimming();
}

public class _05_AnonymityInner {
  public static void main(String[] args) {
    // 使用匿名内部类
    new Swim() {
      @Override
      public void swimming() {
        System.out.println("自由泳...");
      }
    }.swimming();

    // 接口 变量 = new 实现类(); // 多态,走子类的重写方法
    Swim s2 = new Swim() {
      @Override
      public void swimming() {
        System.out.println("蛙泳...");
      }
    };

    s2.swimming();
  }
}
